<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../jquery-3.3.1.min.js"></script>
</head>

<body>
    <script>
        class Car {
            start = 13;
            total = 0;
            price(n) {
                if (n <= 3) {
                    this.total = this.start;
                } else {
                    this.total = this.start + 5 * (n - 3);
                }
                return this.total;
            }
            yongdu(f) {
                if (f == true) {
                    return this.total + 10;
                } else {
                    return this.total;
                }
            }
        }
        var car = new Car();
        console.log('5公里不拥堵的打车价格：' + car.price(5));
        console.log('5公里拥堵的打车价格：' + car.yongdu(true));

        console.log('1公里不拥堵的打车价格：' + car.price(1));
        console.log('1公里拥堵的打车价格：' + car.yongdu(true));
    </script>
</body>

</html>